from django.db import models
from utils.base import Base
# Create your models here.

# 订单表
class Order(Base):

    order = models.CharField('订单号',max_length=64,null=True)

    # 商品外键
    goods = models.ForeignKey('goods.Goods',on_delete=models.SET_NULL,null=True)

    # 用户外键
    user = models.ForeignKey('user.User',on_delete=models.SET_NULL,null=True)

    # 实际支付价格
    practical_price = models.IntegerField('实际支付价格',null=True)

    class Meta:
        db_table = 'tb_order'

# 支付表
class Payment(Base):

    # 订单外键
    order = models.ForeignKey(Order,on_delete=models.SET_NULL,null=True)

    # 支付方式(0为支付宝,1为微信)
    may = models.IntegerField('支付方式',null=True)

    # 状态
    status = models.IntegerField('支付状态(超时或已完成)',default=0)

    class Meta:

        db_table = 'tb_payment'
